/**
 *  Validate of form.
 *  @return boolean
 */
function checkForm() {
    var form = document.forms[0];
    var regEmail = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})$/;
    var regSite = /^(http|https):\/\/(.+)$/;
    var errors = new Array();

    if (form.site_url.value == '' || !form.site_url.value.match(regSite)) {
        errors.push(1); form.site_url.style.border = '1px solid red';
    } else {
        form.site_url.style.border = '1px solid #7c7c7c';
    }
    if (form.email.value == '' || !form.email.value.match(regEmail)) {
        errors.push(1); form.email.style.border = '1px solid red';
    } else {
        form.email.style.border = '1px solid #7c7c7c';
    }
    if (form.login.value == '' || !form.login.value.match(/^[a-zA-Z0-9_.-@]{2,255}$/)) {
        errors.push(1); form.login.style.border = '1px solid red';
    } else {
        form.login.style.border = '1px solid #7c7c7c';
    }
    if (form.password.value == '' || form.password.value.length < 5) {
        errors.push(1); form.password.style.border = '1px solid red';
    } else {
        form.password.style.border = '1px solid #7c7c7c';
    }
    if (errors.length > 0) {
        return false;
    }
    return true;
}
